<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles"
	prefix="tiles"%>

<rich:panel header="#{messages['booking.label']}">
	<h:panelGrid>
		<h:outputText value="#{errorBean.errorMessage}" styleClass="error"></h:outputText>
	</h:panelGrid>
	
	<h:panelGrid width="100%" >
		<h:panelGroup>
		    <h:outputText value="#{messages['member.booking.label']}" styleClass="sub_header" />
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputText value="#{messages['instruction']}" styleClass="standardText_Instruction" />
		</h:panelGroup>
	</h:panelGrid>
	
	<t:panelGrid columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
	
	    <h:outputLabel  for="bookingNo" value="#{messages['booking.no.label']}" styleClass="standardText_Label" />
		<t:inputText  id="bookingNo" readonly="true" size="20" maxlength="20" styleClass="standardText" value="#{adminMemberBookingBean.memberBooking.memberBookingNo}">
		</t:inputText>
		
		<h:outputLabel  for="bookingDate" value="#{messages['booking.no.label']}" styleClass="standardText_Label" />
		<t:inputText  id="bookingDate" readonly="true" size="20" maxlength="20" styleClass="standardText" value="#{adminMemberBookingBean.memberBooking.memberBookingDate}">
			<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Asia/Kuala_Lumpur"/>
		</t:inputText>
		
		<h:outputLabel  for="bookingStatus" value="#{messages['booking.status.label']}" styleClass="standardText_Label" />
		<t:inputText  id="bookingStatus" readonly="true" size="20" maxlength="20" styleClass="standardText" value="#{adminMemberBookingBean.memberBooking.status}">
		</t:inputText>

		<h:outputLabel for="membershipNo" value="#{messages['membership.no.label']}" styleClass="standardText_Label" />
		<h:inputText id="membershipNo"  readonly="true" size="20" maxlength="20" readonly="true" value="#{adminMemberBookingBean.memberBooking.member.membershipNo}" required="true"></h:inputText>
 		
		<h:outputLabel  for="agreementNo" value="#{messages['member.agreement.label']}" styleClass="standardText_Label" />
		<t:inputText id="agreementNo" readonly="true" size="20" maxlength="20" styleClass="standardText" value="#{adminMemberBookingBean.memberPointYear}">
		</t:inputText>
		
		<h:outputText></h:outputText>
		<t:message for="guestName" styleClass="error"></t:message>
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="guestName" value="#{messages['guest.name.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<t:inputText id="guestName"  readonly="true" required="true" size="50" maxlength="50" styleClass="standardText" value="#{adminMemberBookingBean.memberBooking.guestName}"></t:inputText>
		
		<h:outputText></h:outputText>
		<t:message for="bookingPackage" styleClass="error"></t:message>
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="bookingPackage" value="#{messages['booking.package.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
		    <h:inputText size="20" maxlength="20" readonly="true" value="#{adminMemberBookingBean.bookingPackage.packageCode}" required="true"></h:inputText>
			<h:inputHidden required="true" id="bookingPackage" value="#{adminMemberBookingBean.bookingPackage.packageCode}"></h:inputHidden>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="noOfPax" styleClass="error"></t:message>
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="noOfPax" value="#{messages['no.of.pax.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<t:inputText id="noOfPax" required="true" readonly="true" size="3" maxlength="3" styleClass="standardText" value="#{adminMemberBookingBean.memberBooking.noOfPax}"></t:inputText>
		
		<h:outputText></h:outputText>
		<t:message for="noRoom" styleClass="error"></t:message>
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="noRoom" value="No. of Room" styleClass="standardText_Label" />
		</h:panelGroup>
		<t:inputText id="noRoom" required="true" size="3" maxlength="3" readonly="true" styleClass="standardText" value="#{adminMemberBookingBean.memberBooking.noRoom}">
		</t:inputText>

		
		<h:outputText></h:outputText>
		<t:message for="checkIn" styleClass="error"></t:message>
		<h:panelGroup>
	    	<h:outputText value="*" styleClass="standardText_Mandatory" />	
		    <h:outputLabel for="checkIn" value="#{messages['booking.checkin.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
		    	<t:inputCalendar  readonly="true"
		    	id="checkIn"
					monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader" 
					currentDayCellClass="currentDayCell" value="#{adminMemberBookingBean.memberBooking.checkInDate}"
					renderAsPopup="true" popupTodayString="#{messages['popup.today']}"
					popupWeekString="#{messages['popup.week']}" popupDateFormat="dd/MM/yyyy"
					renderPopupButtonAsImage="true"
					styleClass="standardText" required="true"
		    	>
		    	   <a4j:support ajaxSingle="true" event="onchange" action="null" reRender="checkOut" actionListener="#{adminMemberBookingBean.checkInCalendarActionEvent}" ></a4j:support>
		    	</t:inputCalendar>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="checkOut" styleClass="error"></t:message>
		<h:panelGroup>
	    	<h:outputText value="*" styleClass="standardText_Mandatory" />	
		    <h:outputLabel for="checkOut" value="#{messages['booking.checkout.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
		        <t:outputText id="checkOut"  value="#{adminMemberBookingBean.memberBooking.checkOutDate}" styleClass="standardText">
		        	<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Asia/Kuala_Lumpur"/>
		        </t:outputText>
		        <%-- 
		    	<t:inputCalendar
		    	id="checkOut"
					monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader" 
					currentDayCellClass="currentDayCell" value="#{adminMemberBookingBean.memberBooking.checkOutDate}"
					renderAsPopup="true" popupTodayString="#{messages['popup.today']}"
					popupWeekString="#{messages['popup.week']}" popupDateFormat="dd/MM/yyyy"
					renderPopupButtonAsImage="true"
					styleClass="standardText" required="true"
		    	>
		    	</t:inputCalendar>
		    	--%>
		</h:panelGroup>
		
		
		
		<h:outputLabel for="extraBed" value="#{messages['booking.extra.bed.label']}" styleClass="standardText_Label" />
		<t:inputText id="extraBed" required="false"  readonly="true" size="3" maxlength="3" styleClass="standardText" value="#{adminMemberBookingBean.memberBooking.extraBed}"></t:inputText>
	
		<h:outputText></h:outputText>
		<t:message for="confirmationNo" styleClass="error"></t:message>
		<h:panelGroup>
	    	<h:outputText value="*" styleClass="standardText_Mandatory" />	
			<h:outputLabel for="confirmationNo" value="#{messages['booking.confirmation.no.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<t:inputText id="confirmationNo" required="true" size="20" maxlength="20" styleClass="standardText" value="#{adminMemberBookingBean.memberBooking.confirmationNo}"></t:inputText>
		
		<h:outputLabel for="confirmationDate"   value="#{messages['booking.confirmation.date.label']}" styleClass="standardText_Label" />
		<t:inputCalendar required="true" 
		    	id="confirmationDate"
					monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader" 
					currentDayCellClass="currentDayCell" value="#{adminMemberBookingBean.memberBooking.confirmationDate}"
					renderAsPopup="true" popupTodayString="#{messages['popup.today']}"
					popupWeekString="#{messages['popup.week']}" popupDateFormat="dd/MM/yyyy"
					renderPopupButtonAsImage="true"
					styleClass="standardText" 
		    	>
		    	</t:inputCalendar>
		
		
		<h:outputLabel for="remark" value="#{messages['booking.remark.label']}" styleClass="standardText_Label" />
		<t:selectOneMenu id="remark" styleClass="standardText"   readonly="true" value="#{adminMemberBookingBean.remark.remarkId}" required="false">
				<f:selectItem itemLabel="#{messages['please.select']}" itemValue="" />
				<f:selectItems value="#{adminMemberBookingBean.selectRemark}"/>
		</t:selectOneMenu>
			    	
		<h:outputLabel for="otherRemark" value="#{messages['booking.other.remark.label']}" styleClass="standardText_Label" />		
		<t:inputTextarea id="otherRemark" styleClass="standardText"  readonly="true" cols="20" rows="5" value="#{adminMemberBookingBean.memberBooking.otherRemarks}"></t:inputTextarea>

		<h:outputLabel for="totalPoints" rendered="#{adminMemberBookingBean.confirmBooking}" value="#{messages['total.points.label']}" styleClass="standardText_Label" />
		<h:outputText id="totalPoints" rendered="#{adminMemberBookingBean.confirmBooking}" value="#{adminMemberBookingBean.memberBooking.bookingPoint}">
			<f:convertNumber pattern="0.00"/>
		</h:outputText>
		
		<h:outputLabel for="totalPrice" rendered="#{adminMemberBookingBean.confirmBooking}" value="#{messages['total.charges.label']}" styleClass="standardText_Label" />
		<h:outputText id="totalPrice" rendered="#{adminMemberBookingBean.confirmBooking}" value="#{adminMemberBookingBean.memberBooking.bookingPrice}">
			<f:convertNumber pattern="#,###,###,##0.00"/>
		</h:outputText>
		
		<rich:spacer height="10"></rich:spacer>
		
		<t:panelGroup>
		   <t:panelGrid columns="3">
		   		<h:commandButton value="Confirm" rendered="#{!(adminMemberBookingBean.confirmBooking || adminMemberBookingBean.cancelBooking)}" styleClass="button" action="#{adminMemberBookingBean.updateMemberBookingAction}" actionListener="#{adminMemberBookingBean.updateMemberBookingActionEvent}"></h:commandButton>
		   		<h:commandButton value="#{messages['cancel.booking.button']}" immediate="true" rendered="#{ adminMemberBookingBean.canCancelBooking}" styleClass="button" action="#{adminMemberBookingBean.updateMemberBookingAction}" actionListener="#{adminMemberBookingBean.cancelMemberBookingActionEvent}"></h:commandButton>	   		
			    <h:commandButton value="#{messages['back']}" styleClass="button" action="#{adminMemberBookingBean.initMemberBookingListAction}" immediate="true"></h:commandButton>
		   </t:panelGrid>
		</t:panelGroup>
	</t:panelGrid>
	
	<h:panelGrid width="100%" rendered="#{adminMemberBookingBean.lookupPackageForm}" columns="1">
		<h:outputText value="#{messages['booking.package.lookup.label']}" styleClass="sub_header" />
		
		<rich:dataTable id="dataPackage" var="package" value="#{adminMemberBookingBean.bookingPackageList}" rows="20" width="99%">
				<rich:column style="text-align:center;width:20%;">
					<f:facet name="header">
						<h:outputText value="#{messages['package.mgmt.code.column']}"></h:outputText>
					</f:facet>
				
					<h:commandLink action="#{adminMemberBookingBean.navAddMemberBookingAction}" actionListener="#{adminMemberBookingBean.lookupPackageSelectedActionEvent}">
						<h:outputText value="#{package.packageCode}"></h:outputText>
					</h:commandLink>
					<f:param id="packageId" value="#{package.packageId}" />
				</rich:column>	
				
				<rich:column style="text-align:center;width:30%;">
					<f:facet name="header">
						<h:outputText value="#{messages['package.mgmt.desc.column']}"></h:outputText>
					</f:facet>
				
					<h:commandLink action="#{adminMemberBookingBean.navAddMemberBookingAction}" actionListener="#{adminMemberBookingBean.lookupPackageSelectedActionEvent}">
						<h:outputText value="#{package.packageDesc}"></h:outputText>
					</h:commandLink>
				</rich:column>
		</rich:dataTable>
		
		<rich:spacer height="10"></rich:spacer>
					
		<rich:datascroller align="left"  for="dataPackage" maxPages="20" />
			
		<h:commandButton value="#{messages['back']}" styleClass="button" action="null" actionListener="#{adminMemberBookingBean.lookupFormCloseActionEvent}" immediate="true">
		</h:commandButton>
	</h:panelGrid>
</rich:panel>
